package org.xa3apm.vote.servlets;

import java.util.List;

import javax.annotation.Resource;
import javax.transaction.UserTransaction;

import org.xa3apm.vote.exception.VoteException;
import org.xa3apm.vote.hibernate.entities.Province;

public class ReadService {
	@Resource
	private UserTransaction utx;

	// private DAOFactory dao;

	// public void setFactory(DAOFactory daoFactory){
	// this.dao = daoFactory;
	// }

	public List<Province> getAllProvince() throws VoteException {
		try {
			utx.begin();

			// VoteBeanDao voteDAO = dao.getVoteDAOBeanName();
			//
			// utx.commit();
			//
			// return (List<Province>)voteDAO.getProvinceAll();
		} catch (Exception e) {
			try {
				utx.rollback();
			} catch (Exception e2) {
				throw new VoteException("Rollback failed", e2);
			}
		}
		return null;
	}

}
